<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['shop']=pdo_get('jy_friends_shop_shop',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
if($_RQ['op']=='main'){
	$shop=pdo_get('jy_friends_shop_shop',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	if(!$shop){
		$member=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('avatar','nickname'));
		$shop=array(
			'logo'=>$member['avatar'],
			'title'=>$member['nickname'],
		);
	}
	$shop['logo']=tomedia($shop['logo']);
	$return['shop']=$shop;
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$data=array_fields(array('img','logo','title','desc','kfewm'),$postdata);
	$id=intval($postdata['id']);
	if($id){
		pdo_update('jy_friends_shop_shop',$data,array('mid'=>$_SESSION['uid']));
	}else{
		$data['mid']=$_SESSION['uid'];
		$data['uniacid']=$_SESSION['uniacid'];
		pdo_insert('jy_friends_shop_shop',$data);
	}
	
	exi('设置成功','','goback');
}
?>